<?php
// ----------------------------------------------------------------------
// POSTNUKE Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://pncommerce.de
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Source file:  $Source: /cvsroot/pn-commerce/pn-commerce/pnblocks/categorylist.php,v $
//
// Last changes from:  $Author: landseer $
//
// Revision:           $Revision: 1.8 $
//
// Date of revision    $Date: 2004/08/15 12:36:03 $
//  
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------

function pncommerce_categorylistblock_init()
{
    pnSecAddSchema('pncommerce:CategoryBlock:', 'Block title::');
}
function pncommerce_categorylistblock_info()
{
    return array('text_type'      => 'pncommerce_Block',
                 'module'         => 'pncommerce',
                 'text_type_long' => 'Show Categories',
                 'allow_multiple' => true,
                 'form_content'   => false,
                 'form_refresh'   => false,
                 'show_preview'   => true);
}

function pncommerce_categorylistblock_display($blockinfo)
{
    // Security check
    if (!pnSecAuthAction(0, "pncommerce:CategoryBlock:", "$blockinfo[title]::", ACCESS_READ))
    {
        return;
    }
	if (!pnModLoad('pncommerce', 'user'))
	{
		return false;
	}
	if (!pnModAPILoad('pncommerce', 'user'))
	{
		return false;
	}
	$temp = pnSessionGetVar("Open");
	if( @unserialize($temp) <> "" )
	{
	    $Open = unserialize( $temp );
	}
	else
	{
	    $Open = array();
	}

    $smarty =& new pnRender( 'pncommerce' );
    $smarty->caching = false;
    $smarty->assign( 'open', $Open);
    $blockinfo['content'] = $smarty->fetch( 'pncommerce_block_categoryview.html' );
    return themesideblock($blockinfo);
}

?>
